package cn.itcast.bos.service.base.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.itcast.bos.Dao.base.IAreaRepository;
import cn.itcast.bos.domain.base.Area;
import cn.itcast.bos.service.base.IAreaService;

/** 
 * 类说明
 *
 * @author Shao-Fei Fan 
 * @version 1.0,2017年9月5日 上午9:43:36 
 */
@Service
@Transactional
public class AreaServiceImpl implements IAreaService {
	
	@Autowired
	private IAreaRepository areaRepository;
	
	/**
	 * @see cn.itcast.bos.service.base.IAreaService#addAreas(List)
	 */
	@Override
	public void addAreas(List<Area> areas) {
		// 调用dao层
		areaRepository.save(areas);
		
	}
	
	/**
	 * @see cn.itcast.bos.service.base.IAreaService#areaSearch(Pageable, Specification)}
	 */
	@Override
	public Page<Area> areaSearch(Pageable pageable,
			Specification<Area> specification) {
		// 调用dao层
				Page<Area> all = areaRepository.findAll(specification, pageable);
		return all;
	}

}
